<!--
    page description : 근태관리 - 관리자 - 부서관리 화면 - 팀(부서) 등록/수정 (pop_up)
    author      : ych
    date        : 2009-01-09
    file name   : dept_mgr_team_p.jsp
-->
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/htmL1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %> 

<html>
<head>
	<s:head theme="ajax" />
	<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
	<link rel="stylesheet" href="style/style.css" type="text/css" />
	<script src="inc/js/common.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title></title>
<!-- --------------------J A V A S C R I P T START-------------------- -->
    <script type="text/javascript">
        /*
                    팀등록/수정 정보 확인
        */
        function fnc_submit(f) {
            
            if(!frm_validate(f)) {
                return false;
            }
            f.action = "update_team_dept.action"   //form action 설정.
            return true;
        }
        
        //submit이전에 validate
        function frm_validate(f) {
            var cnt = 0;
            var sel_val = f.upper_dept_no.options[f.upper_dept_no.selectedIndex].value; //select tag에서 선택된 value.
            
            if (sel_val == null || sel_val == "" || sel_val.length == 0) {
                alert("<s:text name="alert.message.selectGroupname" />");      //사업그룹이 선택되었는지 확인함.
                f.upper_dept_no.focus();                //해당 태그로 포커스함.
                return false;
            } else if (f.dept_nm.value == null || f.dept_nm.value == "" || f.dept_nm.value.length == 0) {
                alert("<s:text name="alert.message.inputTeamName" />");         //팀명 입력이 없으면 경고창 띄움.
                f.dept_nm.focus();                //해당 태그로 포커스함.
                return false;
            } 
            for(var i=0; i<f.dept_nm.value.length; i++){
                if(f.dept_nm.value.charAt(i)==" "){
                   cnt++;
                }
            }
            if(f.dept_nm.value.length == cnt){
               alert("공백을 허용하지 않습니다.");
               f.dept_nm.focus();
               return false;
            }
            if(!confirm("<s:text name="alert.message.questionApply" />")) {
                return false;
            }
            return true;
        }
        
        //팀수정시 ajax를 적용하여 opener의 죄회 데이터를 바로 적용함.
	    function fnc_apply_change() {
	
	        var rtn_msg = document.getElementById("rtn_msg").value;
	        
	        if(rtn_msg.length != 0)
	        {
	            alert(rtn_msg);
	            window.close();
	            //opener.dojo.event.topic.publish("show_list");
	            opener.call_dojo();
	        }
	        
	    }

    </script>
<!-- --------------------J A V A S C R I P T END-------------------- -->
</head>
<body onload="fnc_apply_change()">
     <s:form name="frm_team_reg_mod" id="frm_team_reg_mod" method="post" theme="simple" onsubmit="return fnc_submit(this)">
         <s:hidden id="rtn_msg"          name="rtn_msg"/>
         <s:hidden id="h_dept_no"        name="dept_no"        value="%{dept_no}" />         <!-- 팀코드 -->
         
       	<div id="popup_350se_top"></div>
        <div id="popup_350se_bg">
	   	<div id="popup_325se">
	   		<div id="popup_325se_box">
	   			<ul>
	    			<li class="txt">그룹명</li>
	    			<li><s:select id="upper_dept_no" name="upper_dept_no" cssClass="combobox140se" headerKey="" headerValue="::그룹명 선택::" list="list_group" listKey="group_no" listValue="group_nm" /></li>
	   			</ul>
	   			<ul>
	    			<li class="txt">팀명</li>
	    			<li><s:textfield id="dept_nm" name="dept_nm" value="%{dept_nm}" cssClass="input_120se" /></li>
	   			</ul>
	   			<ul>
	    			<li class="txt">사용여부</li>
	    			<li><s:select id="use_yn" name="use_yn" value="%{use_yn}" list="#{'Y':'Y', 'N':'N'}" cssClass="combobox140se" /></li>
	   			</ul>
	   		</div>
	   		<div id="popup_btn"><input type="image" value="저장" title="저장" src="/images/btn_save.gif" /></div>
	   	</div>
     	</div>
		<!---------------Bottom : STR----------->
		<div id="popup_350se_bottom"><img src="/images/pop_btn_close.gif" style="cursor: pointer;" onclick="window.close();" /></div>
		<!---------------Bottom : END----------->                
	</s:form>
</body>
</html>